package com.lcry.springcloud.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * ApplicationContextConfig
 *
 * @author lcry
 * @date 2020/03/14 12:05
 * 配置RestTemplate
 */
@Configuration
public class ApplicationContextConfig {
    @Bean //相当于Spring中applicationContext.xml中<bean id="" class="">
    @LoadBalanced //使用此注解赋予RestTemplate负载均衡的能力，测试自定义算法注释掉
    public RestTemplate getRestTemplate() {
        return new RestTemplate();
    }
}
